refactor: federate flutter_cef for cross-platform (macOS + platform_interface; Windows/Linux-ready)#2
Merged
Conversation
First phase of the federated cross-platform restructure (see specs/cross-platform/PLAN.md). Adds packages/flutter_cef_platform_interface holding the shared Dart types (cef_events, cef_input — moved here, history preserved) and the FlutterCefPlatform contract: a PlatformInterface whose default MethodChannelFlutterCef exposes the 'flutter_cef' method channel. The cross-platform contract is that method-channel protocol, which each platform's native plugin speaks. Root flutter_cef now depends on the interface package; the controller reads its channel from FlutterCefPlatform.instance, and the public library re-exports the shared types so consumers' `package:flutter_cef/flutter_cef.dart` imports are unchanged. macOS plugin stays at root for now (moves in P2). Gate: flutter analyze clean (both packages); 94 tests pass. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…kage Second phase of the federated restructure. Relocates the entire macOS implementation — the Swift plugin (macos/), the cef_host native tree (native/), and the bundling tool (tool/) — into packages/flutter_cef_macos, and wires the federation: - New flutter_cef_macos package: implements: flutter_cef, with pluginClass: FlutterCefPlugin + dartPluginClass: FlutterCefMacos (the Dart side just endorses the default method-channel instance). - Podspec renamed flutter_cef.podspec -> flutter_cef_macos.podspec (s.name + repo-root LICENSE path updated). Source files / resources unchanged. - Root flutter_cef pubspec now declares `platforms: macos: default_package: flutter_cef_macos` and depends on it, so a plain dependency on flutter_cef still provides macOS. - The build/bundle scripts moved together with native/, so their relative paths (build_cef_host.sh -> cef_host, bundle_cef_host.sh -> ../native) still resolve. App-facing API and the example are unchanged. The example's GeneratedPluginRegistrant now auto-resolves `import flutter_cef_macos` + FlutterCefPlugin.register — proof the endorsement is correct. Gate: analyze clean (all 3 packages); example macOS build succeeds; cef_host rebuilds + bundles from the new path; render smoke = 1 host + 6 helper subprocesses spawn, clean quit. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Final phase of the federated restructure. Adds PORTING.md — the contract for a Windows/Linux implementation: the small Dart/package side (pubspec endorsement + registerWith), the host-plugin responsibilities, and a precise platform-seam map for cef_host (shared surface / IPC transport / app loop / sandbox / framework path) with main.mm file:line references and the macOS reference for each. Documents the decision to DEFER the native core/platform code-split until the first real non-macOS port (a platform abstraction designed without a second consumer guesses the seam wrong; the seam is mapped in PORTING.md instead). Updates README (federated layout, moved build/bundle paths, Windows/Linux roadmap → PORTING.md) + example README paths. Bumps all four packages to 0.1.3. Gate: analyze clean (all 3 packages); git diff --check clean. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Final-audit remediation (batch 1 of 2): the one real security defect + the
publishability/packaging gaps.
Security (MEDIUM):
- bundle_cef_host.sh selected the dev entitlements.plist (with get-task-allow)
unconditionally, so a distributable bundle re-signed with a real identity
silently re-added get-task-allow (a task-port priv-esc on a JIT process, and a
notarization hard-fail). Now: ad-hoc ("-") keeps the dev plist; a real identity
uses entitlements.release.plist; CEF_HOST_ENTITLEMENTS overrides.
Packaging hygiene (MEDIUM/LOW) for the new federated sub-packages:
- Add LICENSE, README.md, CHANGELOG.md, analysis_options.yaml to both
flutter_cef_platform_interface and flutter_cef_macos (pana/pub.dev require
per-package; the missing analysis_options meant their code wasn't linted).
- Fix the podspec license path '../../../LICENSE' -> '../LICENSE' (the old path
escaped the package tree and broke `pod lib lint` on a standalone extraction).
- Add topics: + issue_tracker: to both sub-package pubspecs.
- Document the publish procedure (path -> hosted constraint swap, bottom-up) in
the root pubspec; keep path deps (correct for the source/path/git consumption
Campus uses) and silence the analyzer's invalid_dependency warning with that
rationale.
Gate: flutter analyze clean across all three packages (whole-package).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Final-audit remediation, batch 2 — verified, no behavior change. Dart: - cef_web_view: `_ensureSession` now bails on `!mounted` first, so the post-frame callback can't read a deactivated MediaQuery or resize a torn-down session after a same-frame removal. - Clarifying comments: the empty `_onPointerPanZoomStart` (required to route pan-zoom updates), `currentTextEditingValue` returning the empty scratch state by design (the page owns the text), and the process-global, never-torn-down static method-call handler. Native (cef_host main.mm): - Header `Args:`/opcode-range comments updated for `--allowed-schemes` and kOpLoadTrusted (0x34). - Gate the three informational bring-up `fprintf(stderr)`s behind FLUTTER_CEF_DEBUG (genuine error prints kept); a release no longer logs noise. - Close `g_ipc_fd` at teardown under the write mutex (was leaked) and clear it. - Document the benign identical-URL trusted-load edge. Swift: - Replace the stale FlutterCefPlugin header verb list (6 of ~27) with a pointer to the switch + PORTING.md as the authoritative protocol reference. Gate: analyze clean; 94 tests pass; cef_host rebuilds clean (0 errors); render smoke OK (host + helpers spawn, clean teardown). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Restructures flutter_cef into a federated Flutter plugin so a Windows or
Linux implementation can be added later as an independent, endorsed package —
without touching the app-facing API or the macOS implementation. No behavior
change; the public API and consumers' imports are unchanged.
Plan + rationale:
specs/cross-platform/PLAN.md. Porting contract:PORTING.md.Structure
Phases (each landed behind a green gate)
flutter_cef_platform_interface: shared DTOs (cef_events,cef_input, moved with history) +FlutterCefPlatform(PlatformInterface) +default
MethodChannelFlutterCef. Root re-exports the types sopackage:flutter_cef/flutter_cef.dartis unchanged. Gate: analyze + 94 tests.macos/,native/cef_host,tool/) intothe endorsed
flutter_cef_macospackage; root declaresdefault_package: flutter_cef_macos. The example's GeneratedPluginRegistrantnow auto-resolves
flutter_cef_macos— proof the endorsement is correct.Gate: example macOS build + cef_host rebuild/bundle from the new path + render
smoke (1 host + 6 helper subprocesses).
core/+platform/code-split deferred by design: aplatform abstraction designed without a second consumer guesses the seam wrong.
The seam is mapped precisely in
PORTING.mdinstead; the split is the firststep of the first real port.
PORTING.md(Dart side + host-plugin duties + the cef_hostplatform-seam map with
main.mmfile:line refs), README/CHANGELOG, bump to0.1.3.
Verification
flutter analyzeclean across all three packages.flutter test— 94 pass.from its new location; renders (helper subprocesses spawn).
🤖 Generated with Claude Code